package com.yzh.lambda;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 于振晗
 * @title: lambda
 * @description: TODO 匿名函数表达式
 * @date 2020年09月04日
 * @path com.yzh
 */
public class LambdaTest implements Test{
    public static void main(String[] args) {
        LambdaTest lambdaTest = new LambdaTest();
        lambdaTest.print();

        Test test = new Test() {
            @Override
            public void print() {
                System.out.println("匿名内部类");
            }
        };
        test.print();

        Test test1 = ()-> System.out.println("lambda表达式");
        test1.print();

        Map mp = new HashMap();
        mp.forEach((n,t)-> System.out.println("asdas"));
    }

    @Override
    public void print() {
        System.out.println("继承实现接口");
    }
}


interface Test{
    void print();
}